import { createWebHistory, createRouter, RouteRecordRaw } from "vue-router";

import HomeView from "../views/HomeView.vue";
import CurrencyExchangeView from "../views/CurrencyExchangeView.vue";
import NewsView from "../views/NewsView.vue";
import NewsDetailsView from "../views/NewsDetailsView.vue";
import Login from "../components/Login.vue";
import Register from "../components/Register.vue";

const routes: RouteRecordRaw[] = [
    { path: "/", name: "Home", component: HomeView },
    { path: "/exchange", name: "CurrencyExchange", component: CurrencyExchangeView },
    { path: "/news", name: "News", component: NewsView },
    { path: "/news/:id", name: "NewsDetails", component: NewsDetailsView },
    { path: "/login", name: "Login", component: Login },
    { path: "/register", name: "Register", component: Register },
]

const router = createRouter({
    history: createWebHistory(), // 这里不使用 createMemoryHistory
    routes
})

export default router